From: Marco Trevisan (TreviƱo) Date: Wed, 1 May 2024 02:18:50 +0000 (+0200) Subject: shell-tray-icon: Use available space when that's defined X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~104^2^2~56 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=9d3546c271c4487ee467dd120db027b0e350cbf3;p=gnome-shell.git shell-tray-icon: Use available space when that's defined Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7613 Part-of: --- diff --git a/src/shell-tray-icon.c b/src/shell-tray-icon.c index 462945e9e..39204bfe6 100644 --- a/src/shell-tray-icon.c +++ b/src/shell-tray-icon.c @@ -185,6 +185,10 @@ shell_tray_icon_allocate (ClutterActor *actor, CLUTTER_ACTOR_CLASS (shell_tray_icon_parent_class)->allocate (actor, box); + na_xembed_set_available_size (NA_XEMBED (tray_icon->tray_child), + roundf (clutter_actor_box_get_width (box)), + roundf (clutter_actor_box_get_height (box))); + /* Find the actor's new coordinates in terms of the stage. */ clutter_actor_get_transformed_position (actor, &wx, &wy); diff --git a/src/tray/na-xembed.c b/src/tray/na-xembed.c index 1a9193974..728bd89ac 100644 --- a/src/tray/na-xembed.c +++ b/src/tray/na-xembed.c @@ -43,6 +43,8 @@ struct _NaXembedPrivate int request_height; int current_width; int current_height; + int available_width; + int available_height; int resize_count; int xembed_version; @@ -141,6 +143,8 @@ na_xembed_end_embedding (NaXembed *xembed) priv->current_width = 0; priv->current_height = 0; priv->resize_count = 0; + priv->available_width = -1; + priv->available_height = -1; g_clear_handle_id (&priv->resize_id, g_source_remove); } @@ -186,6 +190,11 @@ na_xembed_synchronize_size (NaXembed *xembed) width = priv->request_width; height = priv->request_height; + if (priv->available_width >= 0) + width = priv->available_width; + if (priv->available_height >= 0) + height = priv->available_height; + XMoveResizeWindow (xdisplay, priv->socket_window, x, y, @@ -745,6 +754,10 @@ na_xembed_class_init (NaXembedClass *klass) static void na_xembed_init (NaXembed *xembed) { + NaXembedPrivate *priv = na_xembed_get_instance_private (xembed); + + priv->available_width = -1; + priv->available_height = -1; } void @@ -809,6 +822,22 @@ na_xembed_get_size (NaXembed *xembed, *height = priv->request_height; } +void +na_xembed_set_available_size (NaXembed *xembed, + int width, + int height) +{ + NaXembedPrivate *priv = na_xembed_get_instance_private (xembed); + + if (priv->available_width == width && priv->available_height == height) + return; + + priv->available_width = width; + priv->available_height = height; + + na_xembed_resize (xembed); +} + void na_xembed_get_root_position (NaXembed *xembed, int *x, diff --git a/src/tray/na-xembed.h b/src/tray/na-xembed.h index 4466305aa..3b0fdfe03 100644 --- a/src/tray/na-xembed.h +++ b/src/tray/na-xembed.h @@ -58,7 +58,11 @@ void na_xembed_get_size (NaXembed *xembed, int *width, int *height); +void na_xembed_set_available_size (NaXembed *xembed, + int width, + int height); + void na_xembed_set_background_color (NaXembed *xembed, const CoglColor *color); -G_END_DECLS \ No newline at end of file +G_END_DECLS